undef $/;

open IN, "<..\\src\\AnimeJ.js";
$src = <IN>;

$src =~ s/\/\*.*?\*\///sg;

$src =~ s/\/\/.*?\n/\n/sg;

$src =~ s/(\n\s*)+/\n/sg;

$src =~ s/;\s*\n/;/sg;

$src =~ s/{\s*\n/{/sg;

$src =~ s/\s*\n}/}/sg;

$src =~ s/\)\s*\n/\)/sg;

$src =~ s/(\Welse)\s*\n/$1 /sg;

open OUT, ">..\\src\\AnimeJCompact.js";

print OUT "/* http://www.codeplex.com/animej */" . $src;
